#include<iostream>
using std::cout;
using std::cin;
using std::endl;

class Num
{
	private:
	int N;
	int * num;
	int node_sum;
	Num(Num & c1);
	public:
	Num(int n);
	Num(){node_sum=0;num=NULL;}
	~Num();
	void input(int n);
	int n_sum();
	Num & operator = (Num & c1);
};

Num::Num(int n)
{
	N = n;
	num = new int[N];
	node_sum = 0;
}

Num::~Num()
{
	delete [] num;
}

void Num::input(int n)
{
	int i=0;
	while(i<n)
	{
		cin >> num[i];
		node_sum += num[i];
		i++;
	}
}

int Num::n_sum()
{
	return node_sum;
}

Num & Num::operator = (Num & c1)
{
	int i=0;
	N = c1.N;
	node_sum = c1.node_sum;
	num = new int[N];
	while(i<N)
	{
		num[i] = c1.num[i];
		i++;
	}
	return *this;
}

struct Node
{
	Num ab;
	struct Node * next;
};
typedef struct Node Sum;

int main(void)
{
	Sum * head = NULL;
	Sum * tail = NULL;
	Sum * temp = NULL;
	int n;
	cin >> n;
	while( n!=0 )
	{
		temp = new Sum;
		temp->ab = Num(n);
	    temp->ab.input(n);
		temp->next = NULL;
		if ( head==NULL )
		{
			head = temp;
			tail = temp;
		}
		else
		{
			tail->next = temp;
			tail = temp; 
		}
		cin >> n;
	}
	while(head!=NULL)
	{
		cout << head->ab.n_sum() <<endl;
		temp = head;
		head = head->next;
		delete temp;
	}
	return 0;
	
}